#include "dunLoader.h"

t_loader loaderCreate(		char* 	path)
{
	t_loader 				result = malloc(sizeof (struct s_loader));
	result->f = fopen(path, "r");
	result->line = 1;
	return (result);
}

char* loaderGetNextLine(	t_loader	data,
							char		out[],
							size_t 		max)
{
							char* 		result = NULL;

	out[0] = '#';
	if(!feof(data->f))
	{
		while ((!feof(data->f)) && ((out[0] == '#') || (out[0] == '\n')))
		{
			result = fgets(out, max, data->f);
			
		}
		if((feof(data->f)) || (out[0] == '\n'))
			return (NULL);
	}
	return (result);
}
